// pages/detail/detail.js
var utils = require('../../utils/util.js');

var requestPath = utils.requestPath;

var Base64 = require('../../libs/js-base64/base64.modified.js'); 
var WxParse = require('../wxParse/wxParse.js');

Page({
  data:{
    obj: [],
    content:'',
    hide:false
  },
  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数
    var that = this; 
    wx.request({
      url: requestPath+'api/detailTW',
      data: {
        id: options.id,
        devicesId: "1111"
      },
      method:"GET",
      dataType:"json",
      success: function(res) {
        //赋值
        that.setData({
            obj:res.data.obj,
            content:Base64.decode(res.data.obj.content),
            hide: true
        });
     
        WxParse.wxParse('article', 'html', Base64.decode(res.data.obj.content), that,10); 
      },
      fail: function() {
        // fail
      },
      complete: function() {
        // complete
        wx.hideNavigationBarLoading() //完成停止加载
        wx.stopPullDownRefresh() //停止下拉刷新
      }
    });

    
  },
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  },
  onShareAppMessage: function () {
    return {
      title: '我们临空港',
      desc: '我们临空港!'
    }
  }
})